Page({
    goBack() {
      wx.navigateBack({ delta: 1 });
    },
    gotoFriendApply() {
      wx.navigateTo({ url: '/pages/notifyFriendApply/notifyFriendApply' });
    },
    // 点击消息项跳转到聊天页
  gotoChatPage(e) {
    const { userName, userAvatar,userId} = e.currentTarget.dataset;
    const userInfo = {
      name: userName,
      avatar: userAvatar,
      id: userId,
      status: "在线"
    };
    // 编码后传递用户信息，避免特殊字符问题
    const userInfoStr = encodeURIComponent(JSON.stringify(userInfo));
    wx.navigateTo({
      url: `/pages/chatPage/chatPage?userInfo=${userInfoStr}`
    });
  }
});
      